package com.ordertracker.persistent.dictionary;


import org.hibernate.annotations.Type;
import org.joda.time.DateTime;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;


/**
 * Description of class.
 * Created 12/5/12 5:52 PM
 *
 * @author andrey.rodin@playtech.com
 */

@Embeddable
public class AuditEntity implements Serializable {

    private static final long serialVersionUID = -5084348504804206221L;

    @ManyToOne(optional = false, targetEntity = User.class)
    private User createdByUser;

    @Column(nullable = false)
//    @Type(type = "org.joda.time.contrib.hibernate.PersistentDateTime")
    private Date createdDate;

    @ManyToOne(optional = false, targetEntity = User.class)
    private User lastUpdateByUser;

    @Column
//    @Type(type = "org.joda.time.contrib.hibernate.PersistentDateTime")
    private Date lastUpdate;


    public User getCreatedByUser() {
        return createdByUser;
    }

    public Date getCreatedDate() {
        return createdDate;
    }

    public User getLastUpdateByUser() {
        return lastUpdateByUser;
    }

    public Date getLastUpdate() {
        return lastUpdate;
    }

    public void setCreatedByUser(User createdByUser) {
        this.createdByUser = createdByUser;
    }

    public void setCreatedDate(Date createdDate) {
        this.createdDate = createdDate;
    }

    public void setLastUpdateByUser(User lastUpdateByUser) {
        this.lastUpdateByUser = lastUpdateByUser;
    }

    public void setLastUpdate(Date lastUpdate) {
        this.lastUpdate = lastUpdate;
    }
}
